package org.example.transaction.jdbc;

import org.example.session.TransactionIsolationLevel;
import org.example.transaction.Transaction;
import org.example.transaction.TransactionFactory;

import javax.sql.DataSource;
import java.sql.Connection;

/**
 * @Author: luyg
 * @Date: 2024/11/12/20:35
 * @Description:
 */
public class JdbcTransactionFactory implements TransactionFactory {


    @Override
    public Transaction newTransaction(Connection conn) {
        return new JdbcTransaction(conn);
    }

    @Override
    public Transaction newTransaction(DataSource dataSource, TransactionIsolationLevel level, boolean autoCommit) {
        return new JdbcTransaction(dataSource,level,autoCommit);
    }


}
